package com.knowledge.db.mapper;

import com.knowledge.model.pojo.UploadFile;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UploadFileMapper {

    /**
     * @desc 通过md5查询是否有文件存在
     * @param md5
     * @return
     */
    @Select("select count(id) from kw_upload_file where file_md5 = #{md5}")
    public Integer getByMd5(String md5);

    /**
     * @desc 添加文件的记录信息
     * @param uploadFile
     */
    @Insert("insert into kw_upload_file (file_md5,target_file,create_time,update_time) values (#{fileMd5},#{targetFile},#{createTime},#{updateTime})")
    void addFIleRecord(UploadFile uploadFile);
}
